using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Rendering;
using UnityEngine;
[CustomEditor(typeof(Skill_SO))]  
public class RewriteInspector : Editor
{
    private SerializedObject obj;
    private Skill_SO skillSo;
    private SerializedProperty skillType;
    private SerializedProperty AoeRange;
    private SerializedProperty skillObject;

    private void OnEnable()
    {
        obj = new SerializedObject(target);
        skillType = obj.FindProperty("skillType");
        AoeRange = obj.FindProperty("AoeRange");
        skillObject = obj.FindProperty("skillObject");
    }

    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        skillSo =(Skill_SO)target;
        if (skillSo.skillType == SkillType.AoeAttack)
        {
            EditorGUILayout.PropertyField(AoeRange);
        }

        else if (skillSo.skillType == SkillType.singleAttack)
        {
            EditorGUILayout.PropertyField(skillObject);
        }
        
        obj.ApplyModifiedProperties();
    }
}
